<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>采集结果查看 - AI Crawlers</title>
    <!-- 本地CSS资源 -->
    <link href="/assets/libs/css/bootstrap.min.css" rel="stylesheet">
    <link href="/assets/libs/css/all.min.css" rel="stylesheet">
    <link href="/assets/libs/css/dataTables.bootstrap5.min.css" rel="stylesheet">
    <link href="../../assets/css/common.css" rel="stylesheet">
    <style>
        .compare-container {
            display: flex;
            gap: 20px;
            margin-top: 20px;
            align-items: flex-start;  /* 顶部对齐 */
        }
        .compare-item {
            flex: 1;
            min-width: 0;  /* ⭐ 关键：防止flex item被内容撑大 */
            max-width: 33.333%;  /* ⭐ 限制最大宽度（3个平台） */
            border: 1px solid #dee2e6;
            border-radius: 5px;
            padding: 15px;
            background: white;
        }
        
        /* 2个平台时 */
        .compare-container[data-platform-count="2"] .compare-item {
            max-width: 50%;
        }
        
        /* 1个平台时 */
        .compare-container[data-platform-count="1"] .compare-item {
            max-width: 100%;
        }
        
        .compare-item h6 {
            border-bottom: 2px solid #0d6efd;
            padding-bottom: 10px;
            margin-bottom: 15px;
            font-size: 16px;
            font-weight: 600;
        }
        .result-content {
            max-height: 500px;
            overflow-y: auto;
            overflow-x: hidden;  /* ⭐ 隐藏横向滚动 */
            padding: 10px;
            background-color: #f8f9fa;
            border-radius: 5px;
            word-wrap: break-word;  /* ⭐ 自动换行 */
            word-break: break-word;
        }
        
        /* ⭐ 限制图片宽度 */
        .result-content img {
            max-width: 100% !important;
            height: auto !important;
            display: block;
            margin: 10px 0;
        }
        
        /* ⭐ 限制表格宽度 */
        .result-content table {
            max-width: 100% !important;
            table-layout: fixed;
            word-wrap: break-word;
        }
        
        /* ⭐ 限制代码块宽度 */
        .result-content pre,
        .result-content code {
            max-width: 100%;
            overflow-x: auto;
            white-space: pre-wrap;
            word-wrap: break-word;
        }
        
        /* 滚动条样式优化 */
        .result-content::-webkit-scrollbar {
            width: 8px;
        }
        .result-content::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 4px;
        }
        .result-content::-webkit-scrollbar-thumb {
            background: #888;
            border-radius: 4px;
        }
        .result-content::-webkit-scrollbar-thumb:hover {
            background: #555;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 头部 -->
        <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
            <div class="container-fluid">
                <a class="navbar-brand" href="../../index.html">
                    <i class="fas fa-robot me-2"></i>AI Crawlers
                </a>
                <span class="navbar-text text-white">采集结果查看</span>
            </div>
        </nav>

        <!-- 主内容 -->
        <div class="container-fluid mt-4">
            <!-- 搜索区域 -->
            <div class="card mb-4">
                <div class="card-body">
                    <div class="row g-3">
                        <div class="col-md-4">
                            <label class="form-label">选择任务</label>
                            <select class="form-select" id="filterTask">
                                <option value="">请选择任务...</option>
                            </select>
                        </div>
                        <div class="col-md-3">
                            <label class="form-label">平台筛选</label>
                            <select class="form-select" id="filterPlatform">
                                <option value="">全部平台</option>
                                <option value="deepseek">DeepSeek</option>
                                <option value="yuanbao">元宝</option>
                                <option value="doubao">豆包</option>
                            </select>
                        </div>
                        <div class="col-md-3">
                            <label class="form-label">&nbsp;</label>
                            <div>
                                <button class="btn btn-primary" id="searchBtn">
                                    <i class="fas fa-search me-2"></i>查询结果
                                </button>
                                <button class="btn btn-secondary" id="resetBtn">
                                    <i class="fas fa-redo me-2"></i>重置
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 结果列表 -->
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0">
                        <i class="fas fa-list me-2"></i>采集结果列表
                    </h5>
                </div>
                <div class="card-body">
                    <table id="resultTable" class="table table-striped table-hover">
                        <thead>
                            <tr>
                                <th>问句ID</th>
                                <th>问句内容</th>
                                <th>平台</th>
                                <th>回答预览</th>
                                <th>采集状态</th>
                                <th>采集时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <!-- 结果详情对话框 -->
    <div class="modal fade" id="resultDetailModal" tabindex="-1">
        <div class="modal-dialog modal-xl">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">结果详情</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body" id="resultDetailContent">
                    <!-- 动态加载 -->
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 多平台对比对话框 -->
    <div class="modal fade" id="compareModal" tabindex="-1">
        <div class="modal-dialog modal-fullscreen">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">多平台结果对比</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body" id="compareContent">
                    <!-- 动态加载 -->
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="exportHtmlBtn">
                        <i class="fas fa-download me-2"></i>导出HTML
                    </button>
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 本地JS资源（支持独立访问） -->
    <script src="/assets/libs/js/jquery.min.js"></script>
    <script src="/assets/libs/js/bootstrap.bundle.min.js"></script>
    <script src="/assets/libs/js/sweetalert2.all.min.js"></script>
    <script src="/assets/libs/js/jquery.dataTables.min.js"></script>
    <script src="/assets/libs/js/dataTables.bootstrap5.min.js"></script>
    <script src="/assets/libs/js/axios.min.js"></script>
    
    <!-- 自定义JS -->
    <script src="../../assets/js/common/config.js"></script>
    <script src="../../assets/js/common/api.js"></script>
    <script src="../../assets/js/pages/task-results.js?v=20251011-13"></script>
</body>
</html>

